Encoder, robot, and printer

ABSTRACT

An encoder includes a base portion, a rotation portion that is provided to be rotatable about a rotation axis with respect to the base portion, a mark that is disposed around the rotation axis on the rotation portion, an imaging element that is disposed in the base portion and images the marks, a storage portion that stores a reference image, and a determination portion that performs template matching on the mark imaged by the imaging element by using the reference image, so as to determine a rotation state of the rotation portion with respect to the base portion.

BACKGROUND 1. Technical Field

The present invention relates to an encoder, a robot, and a printer.

2. Related Art

An optical rotary encoder is generally known as one kind of encoder (forexample, refer to JP-A-63-187118). For example, a rotary encoder is usedfor a robot provided with a robot arm having a rotatable joint, anddetects rotation states such as a rotation angle, a rotation position, anumber of rotations, and a rotation speed of the joint. The detectionresults are used for drive control of the joint, for example.

For example, the encoder disclosed in JP-A-63-187118 reads a code plateon which a numerical value pattern and a stripe pattern such as a graycode are formed with an imaging element, and detects a position on thebasis of the read numerical value pattern and stripe pattern.

However, in the encoder disclosed in JP-A-63-187118, in order to realizehigh detection accuracy, a high definition pattern is required to beformed on a code plate, and, as a result, there is a problem of causinghigh cost. In the encoder disclosed in JP-A-63-187118, even if the highdefinition pattern is formed on the code plate, there is a problem inthat the detection accuracy is considerably reduced in a case where thepattern is damaged by contamination or the like.

SUMMARY

An advantage of some aspects of the invention is to provide an encodercapable of increasing the detection accuracy while achieving low cost,and to provide a robot and a printer having the encoder.

The invention can be achieved by the following configurations.

An encoder according to an aspect of the invention includes a baseportion; a rotation portion that is provided to be rotatable about arotation axis with respect to the base portion; a mark that is disposedaround the rotation axis on the rotation portion; an imaging elementthat is disposed in the base portion and images the marks; a storageportion that stores a reference image; and a determination portion thatperforms template matching on the mark imaged by the imaging element byusing the reference image, so as to determine a rotation state of therotation portion with respect to the base portion.

According to the encoder having the configuration, since a mark isrecognized by using template matching, and a rotation state of therotation portion with respect to the base portion is determined, it ispossible to determine a rotation state of the rotation portion withrespect to the base portion with high accuracy on the basis of aposition of an image of the mark in a captured image obtained by theimaging element even if a high definition mark is not used. Even if themark is damaged by contamination or the like, it is possible to detect aposition of an image of the mark in a captured image obtained by theimaging element with high accuracy through template matching. Thus, itis possible to increase the detection accuracy while achieving low cost.

In the encoder according to the aspect of the invention, it ispreferable that a plurality of the marks are disposed on the rotationportion, and the imaging element images both of the entire two marksadjacent to each other in a circumferential direction around therotation axis.

With this configuration, even if one of the two marks imaged by theimaging element cannot be accurately read due to contamination or thelike, the other mark can be read, and thus detection can be performed.

In the encoder according to the aspect of the invention, it ispreferable that the determination portion sets a search region in apartial region of a captured image of the mark, and performs thetemplate matching in the search region.

With this configuration, the number of pixels of the search region usedfor template matching can be reduced, and thus a calculation timerelated to the template matching can be reduced. Thus, even in a casewhere angular velocity of the rotation portion is high, it is possibleto perform highly accurate detection. Even if distortion or blurring ofan outer peripheral portion of the captured image in the imaging elementincreases due to aberration of the lens disposed between the imagingelement and the marks, a region in which such distortion or blurring issmall is used as the search region, and thus it is possible to minimizedeterioration in the detection accuracy.

In the encoder according to the aspect of the invention, it ispreferable that the determination portion can change at least one of aposition and a length of the search region in a first direction in thecaptured image on the basis of angular velocity about the rotation axisamong determination results of the past rotation state of the rotationportion.

With this configuration, a more useful search region corresponding to arotation state (angular velocity) of the rotation portion can be set,and thus the number of pixels of the search region used for templatematching can be further reduced.

In the encoder according to the aspect of the invention, it ispreferable that the determination portion calculates the angularvelocity on the basis of determination results of the past two or morerotation states.

With this configuration, it is possible to relatively easily set thesearch region corresponding to a rotation state (angular velocity) ofthe rotation portion.

In the encoder according to the aspect of the invention, it ispreferable that the determination portion can change at least one of aposition and a length of the search region in a first direction in thecaptured image on the basis of angular acceleration about the rotationaxis among determination results of the past rotation state of therotation portion.

With this configuration, a more useful search region corresponding to achange (angular acceleration) in a rotation state (angular velocity) ofthe rotation portion can be set.

In the encoder according to the aspect of the invention, it ispreferable that the determination portion calculates the angularacceleration on the basis of determination results of the past three ormore rotation states.

With this configuration, it is possible to relatively easily set thesearch region corresponding to a change (angular acceleration) in arotation state (angular velocity) of the rotation portion.

In the encoder according to the aspect of the invention, it ispreferable that the determination portion can change at least one of aposition and a length of the search region in a second directionperpendicular to the first direction in the captured image on the basisof a position of the search region in the first direction in thecaptured image.

With this configuration, a more useful search region corresponding to arotation state (rotation angle) of the rotation portion can be set, andthus the number of pixels of the search region used for templatematching can be further reduced.

In the encoder according to the aspect of the invention, it ispreferable that the determination portion can change an attitude of thereference image in the captured image on the basis of informationregarding a rotation angle of the rotation portion with respect to thebase portion.

With this configuration, in a case where a change in an attitude of animage of the mark in the search region is great, it is possible toincrease the accuracy of template matching while reducing a calculationamount related to the template matching.

In the encoder according to the aspect of the invention, it ispreferable that the determination portion determines whether or not arotation angle of the rotation portion with respect to the base portionis larger than a set angle, and changes an attitude of the referenceimage in the captured image on the basis of a determination result.

With this configuration, it is possible to further reduce a calculationamount related to template matching while achieving high accuracy of thetemplate matching.

A robot according to another aspect of the invention includes theencoder according to the aspect of the invention.

According to the robot having the configuration, since the encoder hashigh detection accuracy, it is possible to highly accurate operationcontrol of the robot by using a detection result in the encoder. Sincethe encoder is cheap, it is also possible to achieve low cost of therobot.

A printer according to another aspect of the invention includes theencoder according to the aspect of the invention.

According to the printer having the configuration, since the encoder hashigh detection accuracy, it is possible to perform highly accurateoperation control of the printer by using a detection result in theencoder. Since the encoder is cheap, it is also possible to achieve lowcost of the printer.

BRIEF DESCRIPTION OF THE DRAWINGS

The invention will be described with reference to the accompanyingdrawings, wherein like numbers reference like elements.

FIG. 1 is a side view illustrating a robot according to an embodiment ofthe invention.

FIG. 2 is a sectional view for explaining an encoder according to afirst embodiment of the invention.

FIG. 3 is a diagram for explaining marks provided in the encoderillustrated in FIG. 2.

FIG. 4 is a diagram for explaining a captured image obtained by animaging element provided in the encoder illustrated in FIG. 2.

FIG. 5 is a diagram for explaining template matching in a search regionset in the captured image illustrated in FIG. 4.

FIG. 6 is a diagram illustrating a state in which a correlation value isdeviated by one pixel from a state in which the correlation value is themaximum or the minimum during template matching.

FIG. 7 is a diagram illustrating a state in which a correlation value isthe maximum or the minimum during template matching.

FIG. 8 is a diagram illustrating a state in which a correlation value isdeviated by one pixel toward an opposite side to the state illustratedin FIG. 6 from a state in which the correlation value is the maximum orthe minimum during template matching.

FIG. 9 is a diagram for explaining a search region (a region set bytaking into consideration angular velocity of a rotation portion) in anencoder according to a second embodiment of the invention.

FIG. 10 is a diagram for explaining the search region (a region set bytaking into consideration a movement trajectory of a mark) illustratedin FIG. 9.

FIG. 11 is a diagram for explaining a search region (a region set bytaking into consideration angular velocity and angular acceleration of arotation portion) in an encoder according to a third embodiment of theinvention.

FIG. 12 is a diagram for explaining a search region (a region set bytaking into consideration a rotation angle of a rotation portion) in anencoder according to a fourth embodiment of the invention.

FIG. 13 is a diagram for explaining a reference image (template) in asearch region in an encoder according to a fifth embodiment of theinvention.

FIG. 14 is a diagram illustrating a state in which an attitude of thereference image illustrated in FIG. 13 is changed.

FIG. 15 is a sectional view for explaining an encoder according to asixth embodiment of the invention.

FIG. 16 is a diagram illustrating a schematic configuration of a printerof an embodiment of the invention.

DESCRIPTION OF EXEMPLARY EMBODIMENTS

Hereinafter, an encoder, a robot, and a printer according to embodimentsof the invention will be described in detail with reference to theaccompanying drawings.

Robot

FIG. 1 is a side view illustrating a robot of an embodiment of theinvention. In the following description, for convenience of description,in FIG. 1, an upper part is referred to as an “upper side”, and a lowerpart is referred to as a “lower side”. In FIG. 1, a base side isreferred to as a “basal end”, and an opposite side (end effector side)thereto is referred to as a “distal end side”. In FIG. 1, anupward-and-downward direction is referred to as a “vertical direction”,and a leftward-and-rightward direction is referred to as a “horizontaldirection”.

A robot 100 illustrated in FIG. 1, which is a so-called horizontalarticulated robot (scalar robot), is used for a manufacturing process ofmanufacturing, for example, precision equipment, and can perform holdingor transport of the precision equipment or components.

As illustrated in FIG. 1, the robot 100 includes a base 110, a first arm120, a second arm 130, a work head 140, an end effector 150, and awiring routing portion 160. Hereinafter, the respective portions of therobot 100 will be described briefly in order.

The base 110 is fixed to, for example, a floor surface (not illustrated)via bolts or the like. The first arm 120 is connected to an upper end ofthe base 110. The first arm 120 is rotatable about a first axis J1 alongthe vertical direction with respect to the base 110.

The base 110 is provided with a first motor 111 which generates driveforce for rotating the first arm 120, and a first decelerator 112 whichreduces the driving force from the first motor 111. An input shaft ofthe first decelerator 112 is connected to a rotation shaft of the firstmotor 111, and an output shaft of the first decelerator 112 is connectedto the first arm 120. Thus, if the first motor 111 is driven, and adriving force therefrom is forwarded to the first arm 120 via the firstdecelerator 112, the first arm 120 is rotated about the first rotationaxis J1 in a horizontal plane with respect to the base 110.

The encoder 1 which is a first encoder detecting a state of the firstarm 120 being rotated with respect to the base 110 is provided at thebase 110 and the first arm 120.

A distal end of the first arm 120 is connected to the second arm 130.The second arm 130 is rotatable about a second axis J2 along thevertical direction with respect to the first arm 120. Although notillustrated, the second arm 130 is provided with a second motor whichgenerates drive force for rotating the second arm 130, and a seconddecelerator which reduces the driving force from the second motor. Thedriving force from the second motor is forwarded to the first arm 120via the second decelerator, and thus the second arm 130 is rotated aboutthe second axis J2 in a horizontal plane with respect to the first arm120. Although not illustrated, the second motor is provided with asecond encoder which detects a state of the second arm 130 being rotatedwith respect to the first arm 120.

The work head 140 is disposed at a distal end of the second arm 130. Thework head 140 includes a spline shaft 141 inserted into a spline nut anda ball screw nut (none illustrated) which are disposed in the same scaleat the distal end of the second arm 130. The spline shaft 141 can berotated about an axis thereof and can be moved up and down in thevertical direction, with respect to the second arm 130.

Although not illustrated, the second arm 130 is provided with a rotationmotor and a lifting motor. If drive force from the rotation motor isforwarded to the spline nut via a drive force forwarding mechanism (notillustrated), and thus the spline nut is rotated in normal and reversedirections, the spline shaft 141 is rotated in the normal and reversedirections about an axis J3 along the vertical direction. Although notillustrated, the rotation motor is provided with a third encoder whichdetects a state of the spline shaft 141 being rotated with respect tothe second arm 130.

On the other hand, if drive force from the lifting motor is forwarded tothe ball screw nut via a drive force forwarding mechanism (notillustrated), and thus the ball screw nut is rotated in normal andreverse directions, the spline shaft 141 is moved up and down. Thelifting motor is provided with a fourth encoder detecting a movementamount of the spline shaft 141 with respect to the second arm 130.

A distal end (lower end) of the spline shaft 141 is connected to the endeffector 150. The end effector 150 is not particularly limited, and mayemploy, for example, an effector holding an object to be transported, oran effector processing an object to be processed.

A plurality of wires connected to the respective electronic components(for example, the second motor, the rotation motor, the lifting motor,and the second to fourth encoders) disposed in the second arm 130 arerouted to the base 110 through the tubular wiring routing portion 160which connects the second arm 130 to the base 110. The plurality ofwires are collected inside the base 110, and are thus routed to acontrol device (not illustrated) which is provided outside the base 110and generally controls the robot 100 along with wires connected to thefirst motor 111 and the encoder 1.

As mentioned above, a configuration of robot 100 has been describedbriefly. The robot 100 includes the encoder 1 of any one of a first tofifth embodiments which will be described later. The encoder 1 canachieve low cost, and also increase the detection accuracy. Thus, it ispossible to perform highly accurate operation control of the robot 100by using a detection result in the encoder 1. It is possible to achievelow cost of the robot 100.

Encoder

Hereinafter, the encoder 1 will be described in detail. Hereinafter, adescription will be made of an example of a case where the encoder 1 isincorporated into the robot 100.

First Embodiment

FIG. 2 is a sectional view for explaining an encoder according to afirst embodiment of the invention. FIG. 3 is a diagram for explainingmarks provided in the encoder illustrated in FIG. 2.

As illustrated in FIG. 2, the base 110 of the robot 100 includes asupport member 114 supporting the first motor 111 and the firstdecelerator 112, and stores the first motor 111 and the firstdecelerator 112 therein. The base 110 is provided with the first arm 120which is rotatable about the first axis J1.

The first arm 120 includes an arm main body portion 121 which extendsalong the horizontal direction, and a shaft portion 122 which protrudesdownward from the arm main body portion 121, and the two portions areconnected to each other. The shaft portion 122 is supported at the base110 via a bearing 115 so as to be rotatable about the first axis J1, andis also connected to the output shaft of the first decelerator 112. Theinput shaft of the first decelerator 112 is connected to a rotationshaft 1111 of the first motor 111.

Here, the base 110 is a structural body to which a load based on thedead weight of the base 110 or the mass of other elements supported bythe base 110 is applied. Similarly, the first arm 120 is also astructural body to which a load based on the dead weight of the firstarm 120 or the mass of other elements supported by the first arm 120 isapplied. Materials forming the base 110 and the first arm 120 are notparticularly limited, and may employ, for example, metal materials.

In the present embodiment, outer surfaces of the base 110 and the firstarm 120 form a part of an outer surface of the robot 100. Exteriormembers such as a cover and an impact absorbing material may be attachedto the outer surfaces of the base 110 and the first arm 120.

The relatively rotated base 110 and first arm 120 are provided with theencoder 1 detecting rotation states thereof.

The encoder 1 includes a mark portion 2 provided at the first arm 120, amark detection portion 3 provided at the base 110 and detecting the markportion 2, a determination portion 5 determining relative rotationstates of the base 110 and the first arm 120 on the basis of a detectionresult in the mark detection portion 3, and a storage portion 6 which iselectrically connected to the determination portion 5.

The mark portion 2 is provided at a portion of the arm main body portion121 facing the base 110, that is, a portion surrounding the shaftportion 122 on a lower surface of the arm main body portion 121. Asillustrated in FIG. 3, the mark portion 2 has a plurality of marks 21disposed around the first axis J1 at positions which are different fromthe first axis J1. Here, the marks 21 are provided on the surface of thefirst arm 120. Consequently, a member for providing the marks 21 is notrequired to be provided separately from the base 110 and the first arm120. Thus, it is possible to reduce the number of components. The marks21 are not limited to a case of being directly provided on the surfaceof the first arm 120, and may be provided on a sheet member adhered tothe surface of the first arm 120, and may be provided on a tabularmember which is provided to be rotated along with the first arm 120. Inother words, a member (rotation portion) provided with the marks 21 maybe a member which is rotated about the first axis J1 along with thefirst arm 120 with respect to the base 110.

In the present embodiment, as illustrated in FIG. 3, the plurality ofmarks 21 are a plurality of different position identification marksdisposed to be arranged at an equal interval around the first axis J1.The plurality of marks illustrated in FIG. 3 are alphabetical letters(roman letters) which are different from each other, and twenty-fourletters from A to X are disposed to be arranged at an equal interval inan alphabetical order in the circumferential direction. As a method offorming the marks 21, for example, laser marking, printing, cutting, oretching may be used.

The number and size of marks 21 may be determined depending on, forexample, a necessary resolution, and a resolution of an imaging element31 which will be described later, and are not limited to the illustratedexample, and any number and size may be used. An interval between theplurality of marks 21 in the circumferential direction may not be equal.The marks 21 are not limited to the illustrated roman letters, and mayuse letters such as Arabic letters and Chinese letters, and may use, forexample, symbols, signs, tokens, marks, design, and text other thanletters. The marks 21 may not be necessarily identified by humans aslong as the marks can be identified by the determination portion 5. Forexample, instead of the marks 21, a one-dimensional barcode or a QR code(registered trademark) may be used. Alternatively, the marks may beformed in completely random shapes without periodicity.

The mark detection portion 3 illustrated in FIG. 2 includes the imagingelement 31 provided in the base 110, and a lens 32 provided in anopening of the base 110. The imaging element 31 images some (an imagingregion RI illustrated in FIG. 3) of the marks 21 in the circumferentialdirection of the mark portion 2 via the lens 32. A light source whichilluminates the imaging region RI of the imaging element 31 may beprovided as necessary.

As the imaging element 31, for example, a charge coupled device (CCD) ora complementary metal oxide semiconductor (CMOS) may be used. Theimaging element 31 converts a captured image into an electric signal foreach pixel so as to output the electric signal. As the imaging element31, a two-dimensional imaging element (area image sensor) or aone-dimensional imaging element (line image sensor) may be employed. Theone-dimensional imaging element is preferably disposed in a direction inwhich arrangement of pixels is in contact with a turning circle of thearm. In a case where the two-dimensional imaging element is used, atwo-dimensional image having a large amount of information can beacquired, and thus it becomes easier to increase the detection accuracyof the marks 21 using template matching which will be described later.As a result, it is possible to detect a rotation state of the first arm120 with high accuracy. In a case where the one-dimensional imagingelement is used, since an image acquisition cycle, that is, a so-calledframe rate is high, it is possible to increase a detection frequency,and thus this is advantageous in terms of a high speed operation.

The lens 32 forms an image forming optical system. As the image formingoptical system, any of an unimagnification optical system, anenlargement optical system, and a reduction optical system may be used.Here, as illustrated in FIG. 3, the imaging region RI of the imagingelement 31 is set to overlap a part of the mark portion 2 in thecircumferential direction on the lower surface of the first arm 120.Consequently, the imaging element 31 can image the mark 21 located inthe imaging region RI. Therefore, the mark 21 located in the imagingregion RI is read, and thus a rotation state of the first arm 120 can beunderstood.

The determination portion 5 illustrated in FIG. 2 determines relativerotation states of the base 110 and the first arm 120 on the basis of adetection result in the mark detection portion 3. The rotation statesmay include, for example, a rotation angle, a rotation speed, and arotation direction.

Particularly, the determination portion 5 includes an image recognitioncircuit 51 which performs image recognition on the marks 21 byperforming template matching on a captured image (captured image data)in the imaging element 31 by using a reference image (reference imagedata), and determines relative rotation states of the base 110 and thefirst arm 120 by using a recognition result in the image recognitioncircuit 51. Here, the determination portion 5 is configured to be ableto more finely determine a relative rotation angle (hereinafter, alsosimply referred to as a “a rotation angle of the first arm 120”) of thebase 110 and the first arm 120 on the basis of a position of an image ofthe mark 21 in a captured image obtained by the imaging element 31. Thedetermination portion 5 is configured to be able to obtain a rotationspeed on the basis of a time interval at which the marks 21 aredetected, or to determine a rotation direction on the basis of an orderof the types of detected marks 21. The determination portion 5 outputs asignal corresponding to the above-described determination result, thatis, a signal corresponding to a rotation state of the base 110 and thefirst arm 120. The signal is input to, for example, a control device(not illustrated), and is used to control an operation of the robot 100.At least a part of the determination portion 5 may be incorporated intothe control device as hardware or software.

The determination portion 5 has a function of cutting out a part (aportion including the image of the mark 21) of the captured imageobtained by the imaging element 31, so as to generate a reference image(template). The generation of a reference image is performed on eachmark 21 before determining a relative rotation state of the base 110 andthe first arm 120 or at an appropriate time as necessary. The generatedreference image is stored in the storage portion 6 in correlation witheach mark 21. The determination portion 5 performs template matching byusing the reference image (template) stored in the storage portion 6.Template matching and a determination of a rotation state using thetemplate matching will be described later in detail.

Here, the storage portion 6 stores the reference image (reference imagedata) along with information (identification information) regarding thetype of mark 21 corresponding to the reference image, informationregarding a coordinate (a coordinate of a reference pixel which will bedescribed later) in the captured image, and information (angleinformation) regarding a rotation angle of the first arm 120, incorrelation with each mark 21. As the storage portion 6, a nonvolatilememory and a volatile memory may be used, but the nonvolatile memory ispreferably used from the viewpoint that a state of storing informationcan be held even if power is not supplied, and power can be saved.

As described above, the encoder 1 includes the base 110 which is a “baseportion”, the first arm 120 which is a “rotation portion” provided to berotatable about the first axis J1 which is a “rotation axis” withrespect to the base 110, the marks 21 which are disposed along the firstaxis J1 on the first arm 120, the imaging element 31 which is disposedon the base 110 and captures an image of the mark 21, and thedetermination portion 5 which detects the mark 21 by performing templatematching on a captured image G in the imaging element 31 by using areference image, and determines a rotation state of the first arm 120with respect to the base 110 on the basis of a detection result thereof.

According to the encoder 1, since the mark 21 is recognized by usingtemplate matching, a rotation state of the first arm 120 with respect tothe base 110 is determined, it is possible to determine a rotation stateof the first arm 120 with respect to the base 110 with high accuracy onthe basis of a position of an image of the mark 21 in a captured imageobtained by the imaging element 31 even without using high definitionmarks 21. Even if the marks 21 are damaged by contamination or the like,it is possible to detect a position of an image of the mark 21 in acaptured image obtained by the imaging element 31 with high accuracythrough template matching. Thus, it is possible to increase thedetection accuracy while achieving low cost. The “base portion” can besaid to be a portion including the mark detection portion 3 of the base110, and the “rotation portion” can be said to be a portion includingthe marks 21 of the first arm 120.

Template Matching and Determination of Rotation State using TemplateMatching.

Hereinafter, a detailed description will be made of template matchingand a determination of a rotation state using template matching in thedetermination portion 5. Hereinafter, as an example, a description willbe made of a case where a rotation angle is determined as a rotationstate.

Acquisition of Reference Image

In the encoder 1, a reference image used for template matching isacquired before a rotation state of the first arm 120 with respect tothe base 110 is determined by using template matching. The acquisitionof a reference image may be performed only once before initial templatematching, but may be performed at an appropriate timing as necessarythereafter. In this case, a reference image used for template matchingmay be updated to an acquired new reference image.

When a reference image is acquired, the first arm 120 is rotated aboutthe first axis J1 with respect to the base 110 as appropriate, and animage of each mark 21 is captured by the imaging element 31 for theplurality of marks 21. Each obtained captured image is trimmed, and thusa reference image of each mark 21 is generated. The generated referenceimage is stored in the storage portion 6 along with and in correlationwith identification information thereof, pixel coordinate information,and angle information. Hereinafter, this will be described in detailwith reference to FIG. 4.

FIG. 4 is a diagram for explaining a captured image obtained by theimaging element provided in the encoder illustrated in FIG. 2.

If the first arm 120 is rotated about the first axis with respect to thebase 110, for example, as illustrated in FIG. 4, a mark image 21A whichis an image of the mark 21 indicating the letter “A” reflected in thecaptured image G in the imaging element 31 is moved along circular arcsC1 and C2 in the captured image G. Here, the circular arc C1 is atrajectory drawn by a lower end of the mark image 21A in FIG. 4 due torotation of the first arm 120 with respect to the base 110, and thecircular arc C2 is a trajectory drawn by an upper end of the mark image21A in FIG. 4 due to rotation of the first arm 120 with respect to thebase 110. FIG. 4 illustrates a case where a mark image 21B which is animage of the mark 21 indicating the letter “B” and a mark image 21Xwhich is an image of the mark 21 indicating the letter “X” are reflectedin the captured image G in addition to the mark image 21A.

Here, the captured image G obtained through imaging in the imagingelement 31 has a shape corresponding to the imaging region RI, and has arectangular shape having two sides extending in an X axis direction andtwo sides extending in a Y axis direction. The two sides of the capturedimage G in the X axis direction are disposed along the circular arcs C1and C2 if at all possible. The captured image G has a plurality ofpixels arranged in a matrix form in the X axis direction and the Y axisdirection. Here, a position of a pixel is expressed by a pixelcoordinate system (X,Y) indicated by “X” indicating a position of thepixel in the X axis direction and “Y” indicating a position of the pixelin the Y axis direction. A central region excluding an outer peripheryof the captured image G is set as an effective visual field region RU,and a pixel at an upper left end of the figure in the effective visualfield region RU is set as an origin pixel (0,0) of the pixel coordinatesystem (X, Y).

In a case where a reference image TA for detecting the mark 21indicating the letter “A” is generated, the first arm 120 is rotatedwith respect to the base 110 as appropriate, and the mark image 21A islocated at a predetermined position (in FIG. 4, on a central line LY setat the center in the X axis direction) in the effective visual fieldregion RU. Here, a rotation angle θA0 of the first arm 120 with respectto the base 110 of when the mark image 21A is located at thepredetermined position is acquired in advance through measurement or thelike.

The captured image G is trimmed in a rectangular pixel range as arequired minimum range including the mark image 21A, and thus thereference image TA (a template for detection of the mark 21 indicatingthe letter “A”) is obtained. The obtained reference image TA is storedin the storage portion 6. In this case, the reference image TA is storedalong with and in correlation with identification information regardingthe type of image (in FIG. 4, the letter “A”), angle informationregarding the rotation angle θA0, and pixel information regarding areference pixel coordinate (XA0,YA0) which is a pixel coordinate of areference pixel (in FIG. 4, the pixel at the upper left end) in thepixel range of the reference image TA. In other words, the referenceimage TA, and the identification information, the angle information, andthe pixel coordinate information correlated therewith are a singletemplate set used for template matching.

Determination of Rotation State Using Template Matching

Next, with reference to FIGS. 5 to 8, a description will be made oftemplate matching using the reference image TA generated as describedabove and determination of a rotation state using the template matching.

FIG. 5 is a diagram for explaining template matching in a search regionset in the captured image illustrated in FIG. 4. FIG. 6 is a diagramillustrating a state in which a correlation value is deviated by onepixel from a state in which the correlation value is the maximum or theminimum during template matching. FIG. 7 is a diagram illustrating astate in which a correlation value is the maximum or the minimum duringtemplate matching. FIG. 8 is a diagram illustrating a state in which acorrelation value is deviated by one pixel toward an opposite side tothe state illustrated in FIG. 6 from a state in which the correlationvalue is the maximum or the minimum during template matching.

As illustrated in FIG. 5, when the mark image 21A is present in theeffective visual field region RU, template matching is performed on animage of the effective visual field region RU by using the referenceimage TA. In the present embodiment, the entire effective visual fieldregion RU is set as a search region RS, the reference image TA overlapsthe search region RS, and a correlation value of an overlapping portionbetween the search region RS and the reference image TA is calculatedwhile deviating the reference image TA by one pixel with respect to thesearch region RS. Here, a pixel coordinate of the reference pixel of thereference image TA is moved by one pixel from a start coordinate PS(origin pixel P0) to an end pixel PE, and a correlation value of anoverlapping portion between the search region RS and the reference imageTA is calculated for each pixel coordinate of the reference pixel of thereference image TA with respect to the pixels of the entire searchregion RS. The correlation value is stored in the storage portion 6 incorrelation with the pixel coordinate of the reference pixel of thereference image TA as correlation value data between captured image dataand reference image data.

The maximum correlation value is selected from among the plurality ofcorrelation values for each pixel coordinate stored in the storageportion 6, and a pixel coordinate (XA1,YA1) of the reference image TAhaving the selected correlation value is determined as a pixelcoordinate of the mark image 21A. In the above-described way, it ispossible to detect a position of the mark image 21A in the capturedimage G.

Particularly, a pixel coordinate of the mark image 21A is obtained byusing a subpixel estimation method. As illustrated in FIGS. 6 to 8, thereference image TA overlaps the mark 21 in the vicinity of the maximumcorrelation value. In the state illustrated in FIG. 7, a correlationvalue is greater than in the states (states of being deviated by onepixel from the state illustrated in FIG. 7) illustrated in FIGS. 6 and8, and the correlation value is greatest. However, as in the stateillustrated in FIG. 7, in a case where the reference image TA does notcompletely match the mark 21, and overlaps the mark 21 so as to bedeviated therefrom, if it is determined that the state illustrated inFIG. 7 is determined as being a pixel position of the mark image 21A, adifference therebetween is an error. The difference is a visual fieldsize B to the maximum. In other words, in a case where the subpixelestimation method is not used, the visual field size B is the minimumresolution (accuracy). In contrast, if the subpixel estimation method isused, a correlation value for each visual field size B can be fittedwith a parabola (an equal-angle line may also be used), and thus such aninter-correlation value (inter-pixel pitch) can be complemented(approximated). Thus, it is possible to obtain a pixel coordinate of themark image 21A with higher accuracy. In the above description, as anexample, a description has been made of a case where a pixel coordinateat which a correlation value is the maximum is used for a pixel positionof the mark image 21A, but template matching may be performed such thata pixel coordinate at which a correlation value is the minimum is usedfor a pixel position of the mark image 21A.

As mentioned above, the determination portion 5 sets the search regionRS in the effective visual field region RU which is a partial region ofthe captured image G, and template matching is performed within thesearch region RS. Consequently, the number of pixels of the searchregion RS used for template matching can be reduced, and thus acalculation time related to the template matching can be reduced. Thus,even in a case where angular velocity of the first arm 120 about thefirst axis J1 is high, it is possible to perform highly accuratedetection. Even if distortion or blurring of the outer peripheralportion of the captured image G increases due to aberration of the lens32 disposed between the imaging element 31 and the marks 21, a region inwhich such distortion or blurring is small is used as the search regionRS, and thus it is possible to minimize deterioration in the detectionaccuracy. Generation of the reference image TA and template matching maybe performed by using the entire region of the captured image G, and, inthis case, correction is preferably performed by taking aberration intoconsideration as necessary.

In the present embodiment, since a distance between the imaging regionRI and the first axis J1 is sufficiently long, each of the circular arcsC1 and C2 can be approximated to a substantially straight line in thecaptured image G. Therefore, a movement direction of the mark image 21Ain the captured image G may be considered to match the X axis direction.

Therefore, the mark image 21A is located at a position deviated by thenumber of pixels (XA1-XA0) in the X axis direction with respect to thereference image TA located at the reference pixel coordinate (XA0, YA0).Therefore, in a case where a distance between the center of the imagingregion RI and the first axis J1 is indicated by r, and a width (a visualfield size per pixel of the imaging element 31) of a region on theimaging region RI in the X axis direction, corresponding to one pixel ofthe imaging element 31 is indicated by W, a rotation angle θ of thefirst arm 120 with respect to the base 110 may be obtained by usingEquation (1) as follows.

$\begin{matrix}{\theta = {{\theta\; A\; 0} + {\frac{\left( {{{XA}\; 1} - {{XA}\; 0}} \right) \times W}{2r\;\pi} \times {360\lbrack{^\circ}\rbrack}}}} & (1)\end{matrix}$

In Equation (1), (XA1−XA0)×W corresponds to a distance between an actualposition corresponding to the reference pixel coordinate (XA0,YA0) ofthe reference image TA and an actual position corresponding to the pixelcoordinate (XA1,YA1) of the reference image TA at which theabove-described correlation value is the maximum. 2rπ corresponds to alength of a trajectory of the mark 21 (a length of a circumference) ofwhen the first arm 120 is rotated by 360° with respect to the base 110.θA0 indicates a rotation angle of the first arm 120 with respect to thebase 110 of when the mark image 21A is located at a predeterminedposition as described above. The rotation angle θ is an angle by whichthe first arm 120 is rotated from a reference state (0°) with respect tothe base 110.

In a case where the rotation angle θ is obtained as mentioned above, aso-called subpixel estimation method may be used in which a correlationvalue of a pixel adjacent to the pixel coordinate (XA1,YA1) is fittedwith a parabola or a parabolic curved surface, and thus a coordinate ofthe maximum correlation value is determined. Consequently, a position ofthe mark image 21A in the captured image G can be obtained in a finerresolution than in the pixel unit, and, as a result, it is possible toincrease the detection accuracy of the rotation angle θ.

The above-described template matching and calculation of the rotationangle θ using the template matching are also performed on other marks 21(other than the mark 21 indicating the letter “A”) in the same manner.Here, a reference image corresponding to each mark 21 is registered suchthat at least one of the marks 21 is reflected without being omitted inthe effective visual field region RU, and template matching can beperformed, with respect to any rotation angle θ. Consequently, it ispossible to prevent the occurrence of an angle range in which templatematching cannot be performed.

In FIG. 4 described above, the marks 21 and the effective visual fieldregion RU are configured such that a single mark 21 is reflected withoutbeing omitted in the effective visual field region RU with respect toany rotation angle θ, but the marks 21 and the effective visual fieldregion RU are preferably configured such that a plurality of marks 21are reflected without being omitted in the effective visual field regionRU with respect to any rotation angle θ. In this case, template matchingis performed by using two or more reference images corresponding to twoor more marks 21 adjacent to each other such that the template matchingcan be performed on the plurality of marks 21 reflected in the effectivevisual field region RU with respect to any rotation angle θ. In thiscase, the two or more reference images may partially overlap each other.

In other words, preferably, a plurality of marks 21 are disposed on thefirst arm 120 (rotation portion), and the whole two marks 21 adjacent toeach other in the circumferential direction around the first axis J1(rotation axis) are included and imaged by the imaging element 31.Consequently, even if one of the two marks 21 imaged by the imagingelement 31 cannot be accurately read due to contamination or the like,the other mark 21 can be read, and thus detection can be performed.Thus, there is an advantage in which it becomes easier to ensure highdetection accuracy.

Second Embodiment

FIG. 9 is a diagram for explaining a search region (a region set bytaking into consideration angular velocity of a rotation portion) in anencoder according to a second embodiment of the invention. FIG. 10 is adiagram for explaining the search region (a region set by taking intoconsideration a movement trajectory of a mark) illustrated in FIG. 9.

Hereinafter, the second embodiment will be described focusing on adifference from the above-described embodiment, and a description of thesame content will be omitted.

The present embodiment is the same as the above-described firstembodiment except for a setting range of a search region.

In the first embodiment, the entire region of the effective visual fieldregion RU is set as the search region RS. In other words, in the firstembodiment, correlation values are calculated by performing templatematching on pixels of the entire region of the effective visual fieldregion RU. Here, a calculation time required for determination of therotation angle θ using template matching is proportionate to the numberof pixels of the search region RS. A pixel coordinate required to obtainthe rotation angle θ is only a pixel coordinate at which a correlationvalue is the maximum (a pixel coordinate adjacent thereto is alsonecessary in a case where subpixel estimation is used). Therefore, inthe first embodiment, most of the calculation time is used for uselesscalculation depending on cases.

Therefore, in the present embodiment, a position at which the mark 21 isreflected in the next imaging is predicted by using the past change overtime of the rotation angle θ, and only a pixel region restricted to thevicinity of the position is set as the search region RS. The searchregion RS is set in the above-described way, and thus it is possible toconsiderably reduce a calculation amount regarding template matching andalso to considerably reduce a calculation time.

Specifically, the determination portion 5 stores information regarding adetermination result of the rotation angle θ in the storage portion 6 incorrelation with each mark 21. The determination portion 5 sets(updates) a position and a range of the search region RS by using theinformation regarding the past determination result (rotation angle θ)stored in the storage portion 6.

More specifically, in a case where a time interval of imaging timings ofthe imaging element 31 is constant, when the rotation angle θ determinedby imaging the mark 21 (in FIG. 9, the mark 21 indicating the letter“A”) in the previous time is indicated by θ11, the rotation angle θdetermined by imaging the mark 21 in the second previous time isindicated by θ12, and a predicted rotation angle of the rotation angle θdetermined by imaging the mark 21 this time is indicated by θ14, if arotation speed (angular velocity) of the first arm 120 with respect tothe base 110 is constant, θ11, θ12, and θ14 are expressed by Equation(2) as follows.θ14=θ11+(θ11−θ12)  (2)

Here, as illustrated in FIG. 9, Equation (2) indicates that aninter-center distance between a mark image 21An-1 which is the markimage 21A obtained in the previous imaging and a mark image 21An whichis the mark image 21A obtained in the present imaging is the same as aninter-center distance ΔX between a mark image 21An-2 which is the markimage 21A obtained in the second previous imaging and the mark image21An-1 which is the mark image 21A obtained in the previous imaging.However, actually, since a rotation speed (angular velocity) of thefirst arm 120 with respect to the base 110 generally changes, when achange amount is indicated by Δθ, and the present actual rotation angleθ is indicated by θ13, θ13 is expressed by Equation (3) as follows.θ13=θ14±40  (3)

Here, if the maximum value of Δθ is known, the maximum value is used as40, and thus a range of θ13 can be uniquely determined. If θ14 isdetermined, a deviation (θ14−θΔ0) from the rotation angle θA0 which isangle information of the reference image TA present in the effectivevisual field region RU can also be determined. Since the rotation angleθA0 is known, it can be predicted in which pixel range of the effectivevisual field region RU the mark image 21A matching the reference imageTA is located on the basis of the deviation (θ14−θA0).

Since θ13 has a width of the change amount Δθ, a pixel range L1 of thesearch region RS in the X axis direction is a range obtained by addingat least pixels corresponding to the width of the change amount Δθ tothe pixel range corresponding to the reference image TA with θ14 as areference.

A pixel range of the search region RS in the Y axis direction may be theentire region of the effective visual field region RU in the Y axisdirection in the same manner as in the first embodiment, but a pixelrange of the reference image TA in the Y axis direction or a rangeslightly larger than that in a case where trajectories (circular arcs C1and C2) in which the mark image 21A is moved in the effective visualfield region RU can be regarded as a straight line. In a case where thecircular arcs C1 and C2 in the effective visual field region RU are notregarded as straight lines, as illustrated in FIG. 10, a pixel range L2of the search region RS in the Y axis direction is set in the pixelrange L0 (maximum range) of the circular arcs C1 and C2 in the Y axisdirection in the effective visual field region RU.

The search region RS is set in the above-described way, and, thus, evenif a positional change of the mark image 21A in the Y axis direction inthe effective visual field region RU increases, an appropriate searchregion RS can be set. A pixel range of the search region RS in the Yaxis direction is set to a part of the effective visual field region RUin the Y axis direction, and thus it is possible to considerably reducea calculation amount regarding template matching. Here, since templatematching in the search region RS is preferably performed mainly in the Xaxis direction in a unidimensional manner unlike typical templatematching in which an image is searched relatively widely in atwo-dimensional manner, only a calculation amount of a half or less ofthat in the typical template matching is necessary.

As mentioned above, in the present embodiment, the determination portion5 can change at least one of a position and a length of the searchregion RS in the X axis direction which is a “first direction” in thecaptured image G on the basis of information regarding angular velocityabout the first axis J1 (rotation axis) among determination results ofthe past rotation states of the first arm 120 (rotation portion).Consequently, a more useful search region RS corresponding to a rotationstate (angular velocity) of the first arm 120 can be set, and thus thenumber of pixels of the search region RS used for template matching canbe further reduced.

Here, the determination portion 5 calculates information regardingangular velocity about the first axis J1 of the first arm 120 (rotationportion) with respect to the base 110 (base portion) on the basis ofdetermination results of the past two or more rotation angles θ(rotation states). Consequently, it is possible to relatively easily setthe search region RS corresponding to a rotation state (angularvelocity) of the first arm 120.

According to the second embodiment described above, it is also possibleto increase the detection accuracy while achieving low cost.

Third Embodiment

FIG. 11 is a diagram for explaining a search region (a region set bytaking into consideration angular velocity and angular acceleration of arotation portion) in an encoder according to a third embodiment of theinvention.

Hereinafter, the third embodiment will be described focusing on adifference from the above-described embodiments, and a description ofthe same content will be omitted.

The present embodiment is the same as the above-described firstembodiment except for a setting range of a search region.

In the second embodiment, when the search region RS is set, only theimmediately previous angular velocity of the first arm 120 predicted onthe basis of information regarding the past two rotation angles θ (θ11and θ12), and thus it is necessary to set the search region RS having asize in which the maximum value of the change amount Δθ of the angularvelocity is taken into consideration.

In the present embodiment, when the search region RS is set, informationregarding the past three or more rotation angles θ is used.Consequently, angular acceleration can also be predicted with simplecomputation in addition to angular velocity of the first arm 120. If theangular acceleration is used as mentioned above, Δθ in the aboveEquation (3) is uniquely defined, and thus θ13 can also be determined asa single value. The determined θ13 is only an expected value, and thusit is necessary to obtain the actual rotation angle θ with high accuracyby performing template matching.

For example, as illustrated in FIG. 11, in a case where the inter-centerdistance ΔX between a mark image 21An-1 which is the mark image 21Aobtained in the previous ((n−1)-th) imaging and a mark image 21An-2which is the mark image 21A obtained in the second previous ((n−2)-th)imaging is larger than an inter-center distance ΔX1 between the markimage 21An-2 which is the mark image 21A obtained in the second previous((n−2)-th) imaging and a mark image 21An-3 which is the mark image 21Aobtained in the third previous ((n−3)-th) imaging, an inter-centerdistance ΔX2 between the mark image 21An-1 obtained in the previousimaging and a mark image 21An which is the mark image 21A obtained inthe present imaging is larger than the inter-center distance ΔX.

As mentioned above, in the present embodiment, the determination portion5 can change at least one of a position and a length of the searchregion RS in the X axis direction which is a “first direction” in thecaptured image on the basis of information regarding angularacceleration about the first axis J1 (rotation axis) among determinationresults of the past rotation states of the first arm 120 (rotationportion). Consequently, a more useful search region RS corresponding toa change (angular acceleration) in a rotation state (angular velocity)of the first arm 120 can be set.

Here, the determination portion 5 calculates information regardingangular acceleration about the first axis J1 of the first arm 120(rotation portion) with respect to the base 110 (base portion) on thebasis of determination results of the past three or more rotation anglesθ (rotation states). Consequently, it is possible to relatively easilyset the search region RS corresponding to a change (angularacceleration) in a rotation state (angular velocity) of the first arm120.

According to the third embodiment described above, it is also possibleto increase the detection accuracy while achieving low cost.

Fourth Embodiment

FIG. 12 is a diagram for explaining a search region (a region set bytaking into consideration a rotation angle of a rotation portion) in anencoder according to a fourth embodiment of the invention.

Hereinafter, the fourth embodiment will be described focusing on adifference from the above-described embodiments, and a description ofthe same content will be omitted.

The present embodiment is the same as the above-described firstembodiment except for a setting range of a search region.

The above-described circular arcs C1 and C2 can be obtained throughcomputation on the basis of the distance r between the center of theimaging region RI and the first axis J1, and the distance r can beunderstood in advance by performing imaging in the imaging element 31while rotating the first arm 120 although an accurate value of thedistance r is not obtained. If the circular arc C1 or C2 is known inadvance, the above-described rotation angle θ13 is obtained, and then apixel range which is larger than a pixel size of the reference image TAby a predetermined range can be set as the search region RS by using apixel coordinate corresponding to the rotation angle θ13 on the circulararc C1 or C2 as a predicted pixel coordinate (predicted position) of themark image 21A. In this case, the pixel range L2 of the search region RSin the Y axis direction can be reduced to the minimum (for example, tothe extent to which a pixel size of the reference image TA is enlargedto each of upper and lower sides by one pixel). Consequently, it ispossible to further reduce the number of pixels of the search region RS,and thus to reduce a calculation amount.

As mentioned above, in the present embodiment, the determination portion5 can change at least one of a position and a length of the searchregion RS in the Y axis direction (second direction) which isperpendicular to the X axis direction in the captured image G on thebasis of a position of the search region RS on the X axis (firstdirection) in the captured image G. Consequently, a more useful searchregion RS corresponding to a rotation state (rotation angle) of thefirst arm 120 can be set, and thus the number of pixels of the searchregion RS used for template matching can be further reduced.

According to the fourth embodiment described above, it is also possibleto increase the detection accuracy while achieving low cost.

Fifth Embodiment

FIG. 13 is a diagram for explaining a reference image (template) in asearch region in an encoder according to a fifth embodiment of theinvention. FIG. 14 is a diagram illustrating a state in which anattitude of the reference image illustrated in FIG. 13 is changed.

Hereinafter, the fifth embodiment will be described focusing on adifference from the above-described embodiments, and a description ofthe same content will be omitted.

The present embodiment is the same as the first to fourth embodimentsexcept that angle correction is performed on a reference image asappropriate in template matching.

As described above, since an image of the mark 21 in the effectivevisual field region RU is moved along the circular arcs C1 and C2, anattitude of the image is inclined toward the X axis or the Y axisdepending on a position of the image. If an inclination of the image ofthe mark 21 increases with respect to the reference image TA, an errorof template matching increases (for example, a correlation value isreduced even if positions match each other), and thus the determinationaccuracy of a rotation angle deteriorates. As a method of preventingdeterioration in the determination accuracy of a rotation angle, asdescribed above, there may be a method in which a correlation value isobtained for each pixel position of the reference image TA by deviatingthe reference image TA by one pixel in the search region RS as describedabove, then a correlation value is computed again while slightlychanging, for example, an attitude (angle) of the reference image TA atsome pixel positions where the correlation value is equal to or greaterthan a predetermined value, and a pixel position and an angle causingthe correlation value to be the maximum are determined. However, in thismethod, a calculation amount rapidly increases.

Therefore, in the present embodiment, focusing on the fact that aninclination of an image of the mark 21 in the effective visual fieldregion RU changes depending on the rotation angle θ, for example, anattitude of the reference image TA is changed (hereinafter, alsoreferred to as “an inclination is corrected”) on the basis of therotation angle θ13 obtained in the same manner as in the secondembodiment or the third embodiment. If the rotation angle θ13 isunderstood, an inclined angle β of the reference image TA to becorrected is uniquely defined, and thus only calculation of correctingan inclination of the reference image TA once is added. A calculationamount is slightly increased due to this added calculation, but thedetermination accuracy of the rotation angle θ can be increased.

Meanwhile, in the above-described embodiments, a description has beenmade of a case where the upper left pixel is set as a reference pixel ofthe reference image TA, but, in a case where an inclination of thereference image TA is corrected as in the present embodiment, asillustrated in FIG. 13, it is preferable that a pixel as close to thecenter CP of the reference image TA as possible is set as a referencepixel, and inclination correction is performed by rotating the referenceimage TA by the inclined angle β with the reference pixel as a reference(center). Consequently, it is possible to reduce a position differenceof the reference image TA due to the inclination correction of thereference image TA. Correction of enlarging or reducing the referenceimage TA with the center CP as a reference may be performed.

In a case where inclination correction of the reference image TA isperformed, preferably, pixels corresponding to a predetermined width areadded to the outer periphery of the reference image TA such that a pixelrange of the reference image TA is enlarged, then the pixel range isrotated by an angle (inclined angle β) corresponding to the inclinationcorrection, and the pixel range after being rotated is trimmed to a sizeof the original pixel range of the reference image TA. Consequently, asillustrated in FIG. 14, it is possible to reduce the occurrence of pixeldefects in the reference image TA after inclination correction. Even ifpixel defects occur in the reference image TA, template matching is notimpossible although the detection accuracy is reduced. Even if thereference image TA is not subjected to inclination correction, acalculation amount increases by subjecting the search region RS toinclination correction, but the determination accuracy can be increasedin the same manner.

Such inclination correction of the reference image TA may be performedat each pixel position of the reference image TA, but, in a case wherean inclination of the mark 21 is small, even if inclination correctionof the reference image TA is not performed, there is little influence onthe determination accuracy of the rotation angle θ. Therefore, forexample, in a case where the rotation angle θ13 is predicted asdescribed above, it is determined whether or not the predicted rotationangle θ13 is equal to or less than a predetermined angle, inclinationcorrection of the reference image TA is performed in a case where therotation angle θ13 is more than the predetermined angle, and, on theother hand, a calculation time is reduced by omitting inclinationcorrection of the reference image TA in a case where the rotation angleθ13 is equal to or less than the predetermined angle.

As mentioned above, in the present embodiment, the determination portion5 can change an attitude of the reference image TA in the captured imageG on the basis of information regarding the rotation angle θ13 of thefirst arm 120 (rotation portion) with respect to the base 110 (baseportion). Consequently, in a case where a change in an attitude of animage of the mark 21 in the search region RS is great, it is possible toincrease the accuracy of template matching while reducing a calculationamount related to the template matching.

The determination portion 5 determines whether or not the rotation angleθ13 of the first arm 120 (rotation portion) with respect to the base 110(base portion) is larger than a set angle, and changes an attitude ofthe reference image TA in the captured image G on the basis of adetermination result. Consequently, it is possible to further reduce acalculation amount related to template matching while achieving highaccuracy of the template matching.

Sixth Embodiment

FIG. 15 is a sectional view for explaining an encoder according to asixth embodiment of the invention.

Hereinafter, the sixth embodiment will be described focusing on adifference from the above-described embodiments, and a description ofthe same content will be omitted.

The present embodiment is the same as the first embodiment except for aninstallation position of a mark of the encoder and a configurationrelated thereto.

A robot 10D illustrated in FIG. 15 includes an encoder 1D detecting arotation state of the first arm 120 with respect to the base 110. Theencoder 1D includes a mark portion 2D provided on a circumferentialsurface of the shaft portion 122 of the first arm 120, a mark detectionportion 3 provided at the base 110 and detecting marks (not illustrated)of the mark portion 2D, a determination portions determining relativerotation states of the base 110 and the first arm 120 on the basis of adetection result in the mark detection portion 3, and a storage portion6 which is electrically connected to the determination portion 5.

The mark portion 2D has a plurality of marks (not illustrated) disposedalong a circumferential direction on an outer circumferential surface ofthe shaft portion 122. The plurality of marks may employ, for example,the same marks as the marks 21 of the first embodiment. In other words,a plurality of marks which can be identified, such as letters, numbers,and symbols, are disposed to be arranged in the circumferentialdirection on the circumferential surface (cylindrical surface) of theshaft portion 122. The marks of the mark portion 2D may be directlyprovided on the surface of the shaft portion 122, and may be provided ona cylindrical member attached to the shaft portion 122.

In the present embodiment, the imaging element 31 and the lens 32 of themark detection portion 3 are disposed to detect the marks of the markportion 2D. In other words, a direction in which the marks of the markportion 2D and the mark detection portion 3 are arranged is a direction(in the present embodiment, a direction perpendicular to) intersectingthe first axis J1. Consequently, the marks of the mark portion 2D andthe mark detection portion 3 can be made close to the first axis J1. Asa result, it is possible to achieve miniaturization of the base 110 orthe lightweight base 110.

In the encoder 1D, an imaging region of the imaging element 31 is set onthe outer circumferential surface of the shaft portion 122. Templatematching is performed in the same manner as in the first embodiment. Inthis case, the marks of the mark portion 2D are provided on the outercircumferential surface of the shaft portion 122, and are thus movedlinearly in the imaging region at a constant attitude due to rotation ofthe shaft portion 122. Thus, since a reference image is moved in onlyone direction without changing a direction of the reference image(template) according to an attitude of the mark in the imaging regionwhen template matching is performed, there is an advantage in that acalculation amount related to the template matching can be reduced.

However, since the outer circumferential surface of the shaft portion122 is curved, in a case where the lens 32 is an enlargement opticalsystem or a reduction optical system, a size of the mark of the markportion 2D in the imaging region of the imaging element 31 changesdepending on a position thereof in the imaging region due to a change ina distance to the lens. Therefore, the reference image is preferablyenlarged or reduced when template matching is performed from theviewpoint of increasing the accuracy thereof. Even if such enlargementor reduction of a reference image is not performed, highly accuratetemplate matching can be performed by setting a search region in a smallrange in which a size of the mark of the mark portion 2D can be regardednot to be changed, or by designing the lens 32 such that a size of themark of the mark portion 2D in the search region of the imaging element31 is not changed.

According to the seventh embodiment described above, it is also possibleto increase the detection accuracy while achieving low cost.

Printer

FIG. 16 is a diagram illustrating a schematic configuration of a printerof an embodiment of the invention.

A printer 1000 illustrated in FIG. 16 is a label printing deviceincluding a drum-shaped platen. In the printer 1000, a single sheet S(web) such as a paper type or a film type as a recording medium of whichboth ends are wound on a delivery shaft 1120 and a winding shaft 1140 ina roll form is hung between the delivery shaft 1120 and the windingshaft 1140, and the sheet S is transported from the delivery shaft 1120to the winding shaft 1140 along a transport path Sc hung in theabove-described way. The printer 1000 is configured to record (form) animage on the sheet S by discharging a functional liquid onto the sheet Stransported along the transport path Sc.

The printer 1000 is configured to include a delivery portion 1102 whichdelivers the sheet S from the delivery shaft 1120, a process portion1103 which records an image on the sheet S delivered from the deliveryportion 1102, a laser scanner device 1007 which cuts out the sheet S onwhich the image is recorded in the process portion 1103, and a windingportion 1104 which winds the sheet S on the winding shaft 1140.

The delivery portion 1102 includes the delivery shaft 1120 winding anend of the sheet S thereon, and a driven roller 1121 winding the sheet Sextracted from the delivery shaft 1120 thereon.

In the process portion 1103, the sheet S delivered from the deliveryportion 1102 is supported by a platen drum 1130 as a support portion,and a recording head 1151 or the like disposed in a head unit 1115 whichis disposed along an outer circumferential surface of the platen drum1130 performs an appropriate process so as to record an image on thesheet S.

The platen drum 1130 is a circular drum which is rotatably supported bya support mechanism (not illustrated) centering on a drum shaft 1130 s,and winds the sheet S transported from the delivery portion 1102 to thewinding portion 1104 on a rear surface (a surface on an opposite side toa recording surface) side thereon. The platen drum 1130 is driven torotate in a transport direction Ds of the sheet S as a result ofreceiving friction force with the sheet S, and supports the sheet S fromthe rear surface side in a range Ra in the circumferential directionthereof. Here, the process portion 1103 is provided with driven rollers1133 and 1134 turning the sheet S on both sides of the winding portionto the platen drum 1130. Driven rollers 1121 and 1131 and a sensor Seare provided between the delivery shaft 1120 and the driven roller 1133,and driven rollers 1132 and 1141 are provided between the winding shaft1140 and the driven roller 1134.

The process portion 1103 includes a head unit 1115, and the head unit1115 is provided with four recording heads 1151 corresponding to yellow,cyan, magenta, and black. Each of the recording heads 1151 faces a frontsurface of the sheet S wound on the platen drum 1130 with a slightclearance (platen gap), and discharges a functional liquid of acorresponding color from nozzles in an ink jet method. The respectiverecording heads 1151 discharge functional liquids onto the sheet Stransported in the transport direction Ds, and thus a color image isformed on the front surface of the sheet S.

Here, as the functional liquids, ultraviolet (UV) ink (photocurable ink)which is cured when being irradiated with ultraviolet rays (light) isused. Thus, the head unit 1115 of the process portion 1103 is providedwith first UV light sources 1161 (light irradiation portions) among theplurality of recording heads 1151 in order to temporarily cure the UVink and to fix the UV ink to the sheet S. A second UV light source 1162as a curing portion is provided on a downstream side of the transportdirection Ds with respect to the plurality of recording heads 1151 (headunit 1115).

The laser scanner device 1007 is provided to partially cut out the sheetS on which an image is recorded, or to divide the sheet S. Laser lightwhich is caused to oscillate by a laser oscillator 1401 of the laserscanner device 1007 is applied to the sheet S which is a processedobject via a first lens 1403 and a first mirror 1407 or a second mirror1409 of which positions or rotation positions (angles) are controlled bydrive devices 1402, 1406 and 1408 including the encoder 1. As mentionedabove, an irradiation position of laser light LA applied to the sheet Sis controlled by the respective drive devices 1402, 1406 and 1408, andthus the laser light LA can be applied to a desired position on thesheet S. In the sheet S, a portion thereof irradiated with the laserlight LA is melted, and thus the sheet S is partially cut out ordivided.

The printer 1000 described above includes the encoder 1. The encoder 1can increase the detection accuracy while achieving low cost asdescribed above. Thus, it is possible to perform highly accurateoperation control of the printer 1000 by using a detection result in theencoder 1. It is also possible to achieve low cost of the printer 1000.

As mentioned above, the encoder, the robot, and the printer according tothe preferred embodiments of the invention have been described, but theinvention is not limited thereto, and a configuration of each portionmay be replaced with any configuration having the same function. Anyother constituent element may be added thereto. The configurations ofthe above-described two or more embodiments may be combined with eachother.

In the embodiments, a description has been made of an exemplaryconfiguration in which the base of the robot is a “first member” or a“base portion”, and the first arm is a “second member” or a “rotationportion”, but this is only an example, and one of any two members whichare relatively rotated may be a “first member” or a “base portion”, andthe other member is a “second member” or a “rotation portion”. Alocation where the encoder is provided is not limited to a joint betweenthe base and the first arm, and may be a joint between any two armswhich are relatively rotated. A location where the encoder is providedis not limited to a joint of the robot.

In the above-described embodiments, the number of arms of the robot isone, but the number of arms of the robot is not limited thereto, and maybe, for example, two or more. In other words, the robot according to theembodiments of the invention may be, for example, a robot with two armsor a robot with a plurality of arms.

In the above-described embodiments, the number of arms of the robot istwo, but the number of arms of the robot is not limited thereto, and maybe, for example, one, or three or more.

In the above-described embodiments, a location where the robot accordingto the embodiments of the invention is provided is not limited to afloor surface, and may be, for example, a ceiling surface or a sidewallsurface. The robot according to the embodiments of the invention is notlimited to being provided to be fixed to a structure such as a building,and may be, for example, a leg type walking (traveling) robot havinglegs.

In the above-described embodiments, as an example of a robot accordingto the embodiments of the invention, the horizontal articulated robothas been described, but a robot according to the embodiments of theinvention may be robots of other types such as a vertical articulatedrobot as long as two members which are relatively rotated are providedtherein.

The encoder according to the embodiments of the invention is not limitedto the above-described printer, and may be used for various printerssuch as an industrial printer and a consumer printer with a rotationportion. In a case where the encoder according to the embodiments of theinvention is used for a printer, a location where the encoder isprovided is not limited to the above-described locations, and may beused for a paper feeding mechanism, and a movement mechanism of acarriage mounted with an ink head of an ink jet printer, for example.

The entire disclosure of Japanese Patent Application No. 2017-009720,filed Jan. 23, 2017 is expressly incorporated by reference herein.

What is claimed is:
 1. An encoder comprising: a base; a rotation memberthat is rotationally connected to the base, the rotation member beingrotatable about a rotation axis, the rotation member having a surfacefacing the base; a plurality of marks disposed on the surface of therotation member around the rotation axis; an image sensor that isdisposed in the base, the image sensor being configured to capture afirst image of the marks; a memory configured to store a plurality ofreference images and corresponding coordinates of the reference images,the reference images corresponding to the marks, respectively; and adeterminer configured to: compare each pixel of the captured first imagewith each pixel of the reference images by shifting pixels of thecaptured first image so as to generate correlation values; select acorresponding reference image among the reference images that has amaximum number of the correlation values; determine a number of pixelsshifted from a first pixel of the captured image to a correspondingfirst pixel of the selected corresponding reference image; and determinea relative rotation angle between the base and the rotation member basedon the number of shifted pixels by using the coordinates of the selectedcorresponding reference image.
 2. The encoder according to claim 1,wherein the captured first image includes an entirety of adjacent twomarks of the plurality of marks located in a circumferential directionaround the rotation axis.
 3. The encoder according to claim 1, whereinthe determiner is configured to set a search region in the capturedfirst image, and the determiner is configured to compare each pixel ofthe search region in the captured first image with each pixel of thereference images by shifting pixels of the search region in the capturedfirst image so as to generate the correlation values.
 4. The encoderaccording to claim 3, wherein the determiner is configured to change atleast one of a first position and a first length of the search region ina first direction in the captured first image of based on angularvelocity about the rotation axis.
 5. The encoder according to claim 4,wherein the image sensor is configured to repeatedly capture the firstimage, the determiner is configured to repeatedly perform the comparisonof the pixels with respect to a plurality of the captured first images,the selection of the corresponding reference image, the determination ofthe number of pixels, and the determination of the relative rotationangle, and the determiner is configured to calculate the angularvelocity based on the determined past two or more relative rotationangles.
 6. The encoder according to claim 4, wherein the determiner isconfigured to change at least one of a second position and a secondlength of the search region in a second direction perpendicular to thefirst direction in the captured first image based on the first positionof the search region in the first direction in the captured first image.7. The encoder according to claim 3, wherein the determiner isconfigured to change at least one of a first position and a first lengthof the search region in a first direction in the captured first imagebased on angular acceleration about the rotation axis.
 8. The encoderaccording to claim 7, wherein the image sensor is configured torepeatedly capture the first image, the determiner is configured torepeatedly perform the comparison of the pixels with respect to aplurality of the captured first images, the selection of thecorresponding reference image, the determination of the number ofpixels, and the determination of the relative rotation angle, and thedeterminer is configured to calculate the angular acceleration based onthe determined past three or more relative rotation angles.
 9. Theencoder according to claim 1, wherein the determiner is configured tochange an attitude of the mark in the captured first image based oninformation regarding a rotation angle of the mark in the captured firstimage with respect to the base.
 10. The encoder according to claim 9,wherein the determiner is configured to determine whether the rotationangle of the mark in the captured first image with respect to the baseis larger than a set angle, and when the determiner determines that therotation angle is larger than the set angle, the determiner isconfigured to change the attitude of the mark in the captured firstimage.
 11. A robot comprising: a base; a first arm rotatably connectedto the base, the first arm being rotatable about a rotation axis of ashaft, the first arm having a surface facing the base; a plurality ofmarks disposed on the surface of the first arm around the rotation axis;a second arm rotatably connected to the first arm; an image sensor thatis disposed in the base, the image sensor being configured to capture afirst image of the marks; a memory configured to store a plurality ofreference images and corresponding coordinates of the reference images,the reference images corresponding to the marks, respectively; and adeterminer configured to: compare each pixel of the captured first imagewith each pixel of the reference images by shifting pixels of thecaptured first image so as to generate correlation values; select acorresponding reference image among the reference images that has amaximum number of the correlation values; determine a number of pixelsshifted from a first pixel of the captured image to a correspondingfirst pixel of the selected corresponding reference image; and determinea relative rotation angle between the base and the first arm based onthe number of shifted pixels by using the coordinates of the selectedcorresponding reference image.
 12. A printer comprising: a platen drumon which a recording medium is placed; a recording head through which arecoding fluid is ejected on the recording medium; and a light scannerhaving a light source and an encoder, the light source emitting a lighttoward the recording medium, the encoder controlling a light emittingdirection of the light emitted from the light source, the encoder beingconfigured with: a base; a rotation member that is rotatably connectedto the base, the rotation member being rotatable about a rotation axis,the rotation member having a surface facing the base; a plurality ofmarks disposed on the surface of the rotation member around the rotationaxis; an image sensor that is disposed in the base, the image sensorbeing configured to capture a first image of the marks; a memoryconfigured to store a plurality of reference images and correspondingcoordinates of the reference images, the reference images correspondingto the marks, respectively; and a determiner configured to: compare eachpixel of the captured first image with each pixel of the referenceimages by shifting pixels of the captured first image so as to generatecorrelation values; select a corresponding reference image among thereference images that has a maximum number of the correlation values;determine a number of pixels shifted from a first pixel of the capturedimage to a corresponding first pixel of the selected correspondingreference image; and determine a relative rotation angle between thebase and the rotation member based on the number of shifted pixels byusing the coordinates of the selected corresponding reference image.